#ifndef __CACHEL1_H__
#define __CACHEL1_H__
#include "common.h"

#define CACHEL1_b 6
#define CACHEL1_s 7
#define CACHEL1_t 32 - (CACHEL1_b + CACHEL1_s)
#define CACHEL1_B (1 << CACHEL1_b)
#define CACHEL1_E 8
#define CACHEL1_S (1 << CACHEL1_s)
#define CACHEL1_SIZE CACHEL1_B *CACHEL1_E *CACHEL1_S

extern uint8_t *hw_mem;

void dram_write(hwaddr_t,size_t,uint32_t);
uint32_t dram_read(hwaddr_t,size_t);

typedef union
{
    struct
    {
        uint32_t b : CACHEL1_b;
        uint32_t s : CACHEL1_s;
        uint32_t t : CACHEL1_t;
    };
    uint32_t val;
} CacheL1_addr;

typedef struct
{
    bool valid;
    uint32_t tag;
    uint8_t block[CACHEL1_B];
} CacheL1_line;
uint32_t cacheL1_read(CacheL1_addr addr, size_t len);
void cacheL1_write(CacheL1_addr addr, size_t len, uint32_t data);

#endif